package org.game.gobang.client.support;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import javafx.scene.layout.AnchorPane;
import org.game.gobang.client.constant.ClientConstant;

import java.net.URL;
import java.util.ResourceBundle;

public class RoomInit implements Initializable {
    @FXML
    public AnchorPane room;

    @FXML
    public ListView listView;

    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        listView.setItems(ClientConstant.rooms);
        listView.setOnMouseClicked(mouseEvent -> {
            new JoinRoomBox((String) listView.getSelectionModel().getSelectedItem());
        });
    }
}
